/**
 * <copyright>
 * </copyright>
 *

 */
package hu.bme.mit.androtext.androDataLang.impl;

import hu.bme.mit.androtext.androDataLang.AndroDataLangPackage;
import hu.bme.mit.androtext.androDataLang.DataTypeRef;
import hu.bme.mit.androtext.androDataLang.DataTypes;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Data Type Ref</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link hu.bme.mit.androtext.androDataLang.impl.DataTypeRefImpl#getReferencedDataType <em>Referenced Data Type</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class DataTypeRefImpl extends TypeRefImpl implements DataTypeRef
{
  /**
   * The default value of the '{@link #getReferencedDataType() <em>Referenced Data Type</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getReferencedDataType()
   * @generated
   * @ordered
   */
  protected static final DataTypes REFERENCED_DATA_TYPE_EDEFAULT = DataTypes.STRING;

  /**
   * The cached value of the '{@link #getReferencedDataType() <em>Referenced Data Type</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getReferencedDataType()
   * @generated
   * @ordered
   */
  protected DataTypes referencedDataType = REFERENCED_DATA_TYPE_EDEFAULT;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected DataTypeRefImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return AndroDataLangPackage.Literals.DATA_TYPE_REF;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public DataTypes getReferencedDataType()
  {
    return referencedDataType;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setReferencedDataType(DataTypes newReferencedDataType)
  {
    DataTypes oldReferencedDataType = referencedDataType;
    referencedDataType = newReferencedDataType == null ? REFERENCED_DATA_TYPE_EDEFAULT : newReferencedDataType;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, AndroDataLangPackage.DATA_TYPE_REF__REFERENCED_DATA_TYPE, oldReferencedDataType, referencedDataType));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case AndroDataLangPackage.DATA_TYPE_REF__REFERENCED_DATA_TYPE:
        return getReferencedDataType();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case AndroDataLangPackage.DATA_TYPE_REF__REFERENCED_DATA_TYPE:
        setReferencedDataType((DataTypes)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case AndroDataLangPackage.DATA_TYPE_REF__REFERENCED_DATA_TYPE:
        setReferencedDataType(REFERENCED_DATA_TYPE_EDEFAULT);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case AndroDataLangPackage.DATA_TYPE_REF__REFERENCED_DATA_TYPE:
        return referencedDataType != REFERENCED_DATA_TYPE_EDEFAULT;
    }
    return super.eIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public String toString()
  {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (referencedDataType: ");
    result.append(referencedDataType);
    result.append(')');
    return result.toString();
  }

} //DataTypeRefImpl
